# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time        : 2021/10/27 17:28
@Author      : Albert Darren
@Contact     : 2563491540@qq.com
@File        : ndimage_scipy.py
@Version     : Version 1.0.0
@Description : TODO
@Created By  : PyCharm
"""
from scipy import ndimage
from skimage.io import imread
from DIP_experiment_5.util import contrast_show

# 以灰度图形式读入图像
im_path = "../experiment_fig/chess.jpg"
im = imread(im_path, as_gray=True)  # 读取后图像已经归一化到[0.0,1.0]
log_im = ndimage.gaussian_laplace(im, sigma=1)
sobel_im = ndimage.sobel(im)
prewitt_im = ndimage.prewitt(im)
laplace_im = ndimage.laplace(im)
im_dict = {"origin": im, "log": log_im, "sobel": sobel_im,
           "prewitt": prewitt_im, "laplace": laplace_im}
contrast_show(im_dict,(2,3),wspace=0.4)
